package com.complex.spring.mvc.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.complex.spring.mvc.dal.UserDAOImpl;
import com.complex.spring.mvc.dal.UserDO;

public class LoginServiceImpl implements LoginService {
	// 使用log
	private static final Log logger = LogFactory.getLog(LoginServiceImpl.class);

	
	private UserDAOImpl userDao;

	@Override
	public String create(UserDO user) {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService create====================");
		}
		// TODO Auto-generated method stub
		return userDao.create(user);
	}

	@Override
	public boolean delete(String userId) {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService delete====================");
		}
		// TODO Auto-generated method stub
		return userDao.delete(userId);
	}

	@Override
	public UserDO getUser() {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService getUser====================");
		}
		// TODO Auto-generated method stub
		return userDao.getUser();
	}

	@Override
	public UserDO getUserByLoginId(String loginId) {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService getUserByLoginId====================");
		}
		// TODO Auto-generated method stub
		return userDao.getUserByLoginId(loginId);
	}

	@Override
	public UserDO getUserByUserId(String userId) {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService getUserByUserId====================");
		}
		// TODO Auto-generated method stub
		return userDao.getUserByUserId(userId);
	}

	@Override
	public boolean update(UserDO user) {
		if (logger.isInfoEnabled()) {
			logger
					.info("====================LoginService update====================");
		}
		// TODO Auto-generated method stub
		return userDao.update(user);
	}

	public UserDAOImpl getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDAOImpl userDao) {
		this.userDao = userDao;
	}
	
	
}
